package lpl.com.xyd.test.manage.common.response;

import org.springframework.http.HttpStatus;

import java.io.Serializable;

public class HttpResponse<T> implements Serializable {

    private String code;
    private boolean successful;
    private boolean processing;
    private String message;
    private String errorcode;
    private String errorMessage;
    private T data;

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public boolean isSuccessful() {
        return successful;
    }

    public void setSuccessful(boolean successful) {
        this.successful = successful;
    }

    public boolean isProcessing() {
        return processing;
    }

    public void setProcessing(boolean processing) {
        this.processing = processing;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public String getErrorcode() {
        return errorcode;
    }

    public void setErrorcode(String errorcode) {
        this.errorcode = errorcode;
    }

    public String getErrorMessage() {
        return errorMessage;
    }

    public void setErrorMessage(String errorMessage) {
        this.errorMessage = errorMessage;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public void successful(){
        this.successful = true;
        this.code = HttpStatus.OK.toString();
        this.processing = true;
        this.message = "处理成功";
    }

    public void failfure(){
        this.successful = true;
        this.code = HttpStatus.OK.toString();
        this.processing = false;
        this.message = "处理失败";
    }
}
